<?php
// +----------------------------------------------------------------------
// | ZZYY  [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2023 https://www.fastadmin.net All rights reserved.
// +----------------------------------------------------------------------
// | Author: 乘风
// +----------------------------------------------------------------------

namespace app\admin\model\zzyy;

use think\Model;


class ZzyyUserExtend extends Model
{

    

    

    // 表名
    protected $name = 'zzyy_user_extend';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
    ];


    public function getAcceptSmsList()
    {
        return ['0' => __('Accept_sms 0'), '1' => __('Accept_sms 1')];
    }


    public function getAcceptSmsTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['accept_sms']) ? $data['accept_sms'] : '');
        $list = $this->getAcceptSmsList();
        return isset($list[$value]) ? $list[$value] : '';
    }

    public function user()
    {
        return $this->belongsTo('\\app\\admin\\model\\User', 'user_id', 'id')->setEagerlyType(0);
    }



}